<template>
  <div data-v-c4eb68fc="" class="login pc-login" style="top: 0px">
    <div data-v-c4eb68fc="" class="login-header">
      <img
        data-v-c4eb68fc=""
        src="../../assets/img/login-logo.9adac4f.png"
        alt=""
      />
    </div>
    <div data-v-c4eb68fc="" class="tab_code_box" style="height: 1029px">
      <form data-v-c4eb68fc="" class="tab_code_item">
        <input
          data-v-c4eb68fc=""
          type="text"
          name="name"
          placeholder="请输入用户名注册"
          autocomplete="off"
          class="tab_code_name"
          v-model="userinfo.name"
        />
        <div data-v-c4eb68fc="" class="code_parent clearfix">
          <input
            data-v-c4eb68fc=""
            type="password"
            placeholder="请输入密码"
            class="tab_code_password"
            v-model="userinfo.password"
          />
        </div>
        <div
          data-v-c4eb68fc=""
          id="captcha"
          class="captcha nc-container"
          style="display: none"
        >
          <div class="_nc">
            <div id="nc_1-stage-1" class="stage stage1" style="display: block">
              <div class="slider">
                <div class="label">请向右滑动验证</div>
                <div class="track">
                  <div class="bg-green"></div>
                </div>
                <div class="button">
                  <div
                    class="icon nc-iconfont icon-slide-arrow"
                    id="nc_1_n1t"
                  ></div>
                </div>
              </div>
            </div>
            <div id="nc_1-stage-2" class="stage stage2" style="display: none">
              <div class="textbox">
                <input
                  class="input"
                  type="text"
                  maxlength="6"
                  autocomplete="off"
                  autocorrect="off"
                  autocapitalize="off"
                  spellcheck="false"
                />
                <div class="placeholder" style="display: block">验证码</div>
                <div class="icon tip nc-iconfont icon-message"></div>
                <div
                  class="icon clear nc-iconfont icon-close-white"
                  style="display: none"
                ></div>
                <div class="icon refresh nc-iconfont icon-refresh"></div>
                <img class="code" width="100" height="30" alt="" />
              </div>
              <div class="ope">
                <button class="btn-ok" disabled="">确 定</button>
                <div class="tips">验证码错误，请重新输入</div>
              </div>
            </div>
            <div id="nc_1-stage-3" class="stage stage3" style="display: none">
              <div class="title">非常抱歉，这出错了</div>
              <span id="nc_1_refresh1" class="menu refresh">
                <span
                  id="nc_1_refresh2"
                  class="icon nc-iconfont icon-refresh"
                ></span
                ><span id="nc_1_refresh3" class="label">刷新</span>
              </span>
              <span class="menu nc-sep"></span>
              <span class="menu feedback">
                <span class="icon nc-iconfont icon-message"></span
                ><span class="label">反馈</span>
              </span>
            </div>
          </div>
        </div>
      </form>
      <input
        data-v-c4eb68fc=""
        type="submit"
        value="注册"
        :disabled="ischeckall"
        :class="['tab_code_submit', { submitColor: ischeckall }]"
        @click="handlereg"
      />
      <div data-v-c4eb68fc="" class="xieyi">
        <img
          data-v-c4eb68fc=""
          src=""
          alt="不同意"
          v-if="!isagree"
          @click="isagree = !isagree"
        />
        <img
          data-v-c4eb68fc=""
          src=""
          alt="同意"
          v-if="isagree"
          @click="isagree = !isagree"
        />
        <!---->
        <p data-v-c4eb68fc="">
          同意并遵守
          <router-link to="/children/agreement2"
            ><span data-v-c4eb68fc="">《药兜网用户服务协议》</span></router-link
          >与<router-link to="/children/privacypolicy"
            ><span data-v-c4eb68fc="">《药兜网隐私权政策》</span></router-link
          >
        </p>
      </div>
      <div data-v-c4eb68fc="" class="xieyi" style="justify-content: center">
        <p>
          <router-link to="/children/login"
            ><span data-v-c4eb68fc="">已有账号？立即登录</span></router-link
          >
        </p>
      </div>
    </div>
  </div>
</template>

<script>
import { register } from "../../api/zl-goods";
export default {
  data() {
    return {
      isagree: false,
      userinfo: {
        name: "",
        password: "",
      },
    };
  },
  methods: {
    handlereg() {
      register(this.userinfo).then(res=>{
        if(res.data.code){
          this.$router.push({ path: '/children/login', query: { target: '/' } });
        }
      });
    },
  },
  computed: {
    ischeckall() {
      let { name, password } = this.userinfo;
      let bool = name == "" || password == "" || !this.isagree;
      return bool;
    },
  },
};
</script>

<style lang="less" scoped>
</style>